﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using zielonka.co.uk.extensions.system;

namespace zielonka.co.uk.extensions.tests.system.string_
{
    [TestClass]
    public class IsLike
    {
        [TestMethod]
        public void MatchAstrixWildCard()
        {
            string match = "abc";
            var actual = match.IsLike("a*");
            var expected = true;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void MatchSingleCharacterWildCardAtStart()
        {
            string match = "abc";
            var actual = match.IsLike("?bc");
            var expected = true;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void MatchSingleCharacterWildCardInMiddle()
        {
            string match = "abc";
            var actual = match.IsLike("a?c");
            var expected = true;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void MatchSingleCharacterWildCardAtEnd()
        {
            string match = "abc";
            var actual = match.IsLike("ab?");
            var expected = true;
            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void MatchAnythingWith3Integers()
        {
            string match = "abc123";
            var actual = match.IsLike("*###");
            var expected = true;
            Assert.AreEqual(expected, actual);
        }

        //TODO:Change this to a NOT Like perhaps?
        [TestMethod]
        public void IsNOTtheSameAs()
        {
            string match = "joe";
            var actual = match.IsLike("[!aeiou]*");
            var expected = true;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void IsMatchRegExCasing()
        {
            string match = "GIKoe";
            var actual = match.IsLike("[A-Z][A-Z][A-Z][a-z][a-z]");
            var expected = true;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ShouldNotMatchLowerCase()
        {
            string match = "g";
            var actual = match.IsLike("[A-Z]");
            var expected = false;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ShouldNotMatchUpperCase()
        {
            string match = "G";
            var actual = match.IsLike("[a-z]");
            var expected = false;
            Assert.AreEqual(expected, actual);
        }
    }
}
